using System;
using System.Collections.Generic;
using System.Text;
using System.Xml;
using Barrage.GUI.Elements;
using Barrage.Global;

namespace Barrage.GUI
{
    sealed class GUIElementTypes
    {
        private GUIElementTypes() { }

        public const string ButtonList = "ButtonList";
        public const string Button = "Button";
        public const string Image = "Image";
        public const string Cursor = "Cursor";
        public const string Text = "Text";
    }
    sealed class GUIElementLoader
    {
        public static GUIElement LoadElement(GUILayout layout, string type, XmlNode n, string template)
        {
            long initTime = Timer.DefaultTimer.CurrentTotalTime;
            GUIElement element = null;
            switch (type)
            {
                case GUIElementTypes.ButtonList:
                    element=GUITemplateManager.CreateButtonList(layout, template, n);
                    break;
                case GUIElementTypes.Button:
                    element=GUITemplateManager.CreateButton(layout, template, n);
                    break;
                case GUIElementTypes.Image:
                    element=GUITemplateManager.CreateImage(layout, template, n);
                    break;
                case GUIElementTypes.Cursor:
                    element=GUITemplateManager.CreateCursor(layout, template, n);
                    break;
                case GUIElementTypes.Text:
                    element = GUITemplateManager.CreateText(layout, template, n);
                    break;
            }
            NLog.LogManager.GetCurrentClassLogger().Debug("Element " + type + " created in " + (Timer.DefaultTimer.CurrentTotalTime - initTime) + " ms");
            return element;
        }
    }
}
